﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
using System.Text;
using System.Windows.Browser;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Collections.ObjectModel;

namespace SkyDriveConnector
{
    public class SkyDriveObject
    {

        string _filetype;

        public string id { get; set; }
        public SkyDriveObjectFrom from { get; set; }
        public string name { get; set; }
        public string description { get; set; }
        public string parent_id { get; set; }
        public string upload_location { get; set; }
        public int count { get; set; }
        public string link { get; set; }
        public string source { get; set; }
        public string icon { get; set; }
        public string type
        {
            get
            {
                return _filetype;
            }

            set
            {
                _filetype = value;

                icon = "images/empty.png";

                if (this.source != null)
                {
                    if (source.Contains("docx"))
                        icon = "images/doc.png";
                    else if (source.Contains("xlsx"))
                        icon = "images/xls.png";
                    else if (source.Contains("pdf"))
                        icon = "images/pdf.png";
                    else if (source.Contains("jpg"))
                        icon = "images/gif.png";
                }

                if(value == "folder")
                    icon = "images/folder.png";
                else if(value == "album")
                    icon = "images/album.png";

                    
            }


        }
        public string shared_with { get; set; }
        public string created_time { get; set; }
        public string updated_time { get; set; }


        public SkyDriveObject()
        {


        }
    }


    public class SkyDriveItems
    {
        public SkyDriveObject[] data;
    }

    public class SkyDriveObjectFrom
    {
        public string name { get; set; }
        public string id { get; set; }
    }

    public class SkyDriveResponse
    {
        public string id { get; set; }
        public string source { get; set; }
        public string filename { get; set; }
        public string parentid { get; set; }
        
    }

    public static class SkyDriveActions
    {
        public const string GET = "GET";
        public const string PUT = "PUT";
        public const string DELETE = "DELETE";
    }


    public class SharePointResponse
    {
        public string Message { get; set; }


    }

    public class ResponseMessage
    {
        public int CorrelationId { get; set; }
        public DateTime TimeStamp { get; set; }
        public string Message { get; set; }
    }

    public class SkyDriveLoadingComplete : EventArgs
    {
        public string EventData { get; set; }
    }


    public class SkyDriveList
    {

        public string ViewGuid { get; set; }
        public string ListName { get; set; }
        public Dictionary<string, string> Fields { get; set; }
        public string ListVersion { get; set; }

        public string ViewFields { get; set; }
        public string SkyDriveObjectId { get; set; }
        public bool IsPopulated { get; set; }

    }

    

    public class FieldValue
    {
        
        public string FieldDisplayName { get; set; }
        public string Value { get; set; }
      

    }


    public class Batch
    {
        [XmlAttribute]
        public string OnError { get; set; }

        [XmlAttribute]
        public string RootFolder { get; set; }

        [XmlAttribute]
        public string ListVersion { get; set; }

        [XmlElement]
        public Method Method { get; set; }
    }
    
    public class Method
    {
        [XmlAttribute]
        public string ID { get; set; }

        [XmlAttribute]
        public string Cmd { get; set; }

        [XmlElement]
        public List<Field> Field { get; set; }
    }

    public class Field
    {
        [XmlAttribute]
        public string Name { get; set; }

        [XmlText]
        public string Value { get; set; }

    }


    public class TraceLog
    {
        public  ObservableCollection<ResponseMessage> ResponseMessages { get; set; }

    }
}
